import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
import { ApiProperty } from '@nestjs/swagger';
import { Document } from 'mongoose';

export type UserDocument = User & Document;

@Schema()
export class User extends Document {
  @Prop({
    required: true,
  })
  @ApiProperty({
    description: '手机号',
    example: '18000000000',
  })
  readonly phone: string;

  @Prop({
    required: true,
  })
  @ApiProperty({
    description: '密码',
    example: '123456',
  })
  readonly password: string;

  @Prop()
  readonly salt?: string;
}

export const UserSchema = SchemaFactory.createForClass(User);
